import QtQuick 1.0
import Box2D 1.0

/*For use in the Dynamite class
These bodies act as charges that are ejcted
from the dynamite on explosion*/

Component{
	id: component
	Body{
	   id: body
	   x:0; y:0
	   height: 5
	   width: 5
	   sleepingAllowed: true
	   rotation: Math.floor(Math.random()*361) //random between 0-360

	   fixtures: Box{
		   anchors.fill: parent
		   density: 1
		   friction: 0.5
		   restitution: 0.5
	   }

	   Component.onCompleted: {
		   body.applyTorque(100)
//		   timer.start()
	   }

	   Timer{
		   id:timer
		   interval:1000
		   onTriggered: {
//			   body.parent.unregisterBody(body)
//			   body.destroy()
			   console.log("delete")
		   }
	   }

	   //Show location of charges on screen
	   Rectangle{
		  anchors.fill: parent
		  color: "red"
	   }

	}
}



